\(\int \cot (c+d x) (a+b \tan (c+d x)) (A+B \tan (c+d x)) \, dx\) [235]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 27, antiderivative size = 37 \[ \int \cot (c+d x) (a+b \tan (c+d x)) (A+B \tan (c+d x)) \, dx=(A b+a B) x-\frac {b B \log (\cos (c+d x))}{d}+\frac {a A \log (\sin (c+d x))}{d} \]

[Out]

(A*b+B*a)*x-b*B*ln(cos(d*x+c))/d+a*A*ln(sin(d*x+c))/d

Rubi [A] (verified)

Time = 0.09 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.111, Rules used = {3670, 3556, 3612} \[ \int \cot (c+d x) (a+b \tan (c+d x)) (A+B \tan (c+d x)) \, dx=x (a B+A b)+\frac {a A \log (\sin (c+d x))}{d}-\frac {b B \log (\cos (c+d x))}{d} \]

[In]

Int[Cot[c + d*x]*(a + b*Tan[c + d*x])*(A + B*Tan[c + d*x]),x]

[Out]

(A*b + a*B)*x - (b*B*Log[Cos[c + d*x]])/d + (a*A*Log[Sin[c + d*x]])/d

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3612

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c +
b*d)*(x/(a^2 + b^2)), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rule 3670

Int[(((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]))/((a_.) + (b_.)*tan[(e_.)
 + (f_.)*(x_)]), x_Symbol] :> Dist[B*(d/b), Int[Tan[e + f*x], x], x] + Dist[1/b, Int[Simp[A*b*c + (A*b*d + B*(
b*c - a*d))*Tan[e + f*x], x]/(a + b*Tan[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a
*d, 0]

Rubi steps \begin{align*} \text {integral}& = (b B) \int \tan (c+d x) \, dx+\int \cot (c+d x) (a A+(A b+a B) \tan (c+d x)) \, dx \\ & = (A b+a B) x-\frac {b B \log (\cos (c+d x))}{d}+(a A) \int \cot (c+d x) \, dx \\ & = (A b+a B) x-\frac {b B \log (\cos (c+d x))}{d}+\frac {a A \log (\sin (c+d x))}{d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.06 (sec) , antiderivative size = 49, normalized size of antiderivative = 1.32 \[ \int \cot (c+d x) (a+b \tan (c+d x)) (A+B \tan (c+d x)) \, dx=A b x+a B x+\frac {a A \log (\cos (c+d x))}{d}-\frac {b B \log (\cos (c+d x))}{d}+\frac {a A \log (\tan (c+d x))}{d} \]

[In]

Integrate[Cot[c + d*x]*(a + b*Tan[c + d*x])*(A + B*Tan[c + d*x]),x]

[Out]

A*b*x + a*B*x + (a*A*Log[Cos[c + d*x]])/d - (b*B*Log[Cos[c + d*x]])/d + (a*A*Log[Tan[c + d*x]])/d

Maple [A] (verified)

Time = 0.11 (sec) , antiderivative size = 47, normalized size of antiderivative = 1.27

method result size
parallelrisch \(\frac {\left (-a A +B b \right ) \ln \left (\sec ^{2}\left (d x +c \right )\right )+2 a A \ln \left (\tan \left (d x +c \right )\right )+2 d x \left (A b +B a \right )}{2 d}\) \(47\)
norman \(\left (A b +B a \right ) x +\frac {a A \ln \left (\tan \left (d x +c \right )\right )}{d}-\frac {\left (a A -B b \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}\) \(48\)
derivativedivides \(\frac {\frac {\left (-a A +B b \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (A b +B a \right ) \arctan \left (\tan \left (d x +c \right )\right )+a A \ln \left (\tan \left (d x +c \right )\right )}{d}\) \(52\)
default \(\frac {\frac {\left (-a A +B b \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (A b +B a \right ) \arctan \left (\tan \left (d x +c \right )\right )+a A \ln \left (\tan \left (d x +c \right )\right )}{d}\) \(52\)
risch \(A b x +B a x -i A a x +i B b x -\frac {2 i a A c}{d}+\frac {2 i B b c}{d}+\frac {a A \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}{d}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B b}{d}\) \(77\)

[In]

int(cot(d*x+c)*(a+b*tan(d*x+c))*(A+B*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/2*((-A*a+B*b)*ln(sec(d*x+c)^2)+2*a*A*ln(tan(d*x+c))+2*d*x*(A*b+B*a))/d

Fricas [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 59, normalized size of antiderivative = 1.59 \[ \int \cot (c+d x) (a+b \tan (c+d x)) (A+B \tan (c+d x)) \, dx=\frac {2 \, {\left (B a + A b\right )} d x + A a \log \left (\frac {\tan \left (d x + c\right )^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) - B b \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right )}{2 \, d} \]

[In]

integrate(cot(d*x+c)*(a+b*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="fricas")

[Out]

1/2*(2*(B*a + A*b)*d*x + A*a*log(tan(d*x + c)^2/(tan(d*x + c)^2 + 1)) - B*b*log(1/(tan(d*x + c)^2 + 1)))/d

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 78 vs. \(2 (34) = 68\).

Time = 0.21 (sec) , antiderivative size = 78, normalized size of antiderivative = 2.11 \[ \int \cot (c+d x) (a+b \tan (c+d x)) (A+B \tan (c+d x)) \, dx=\begin {cases} - \frac {A a \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {A a \log {\left (\tan {\left (c + d x \right )} \right )}}{d} + A b x + B a x + \frac {B b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} & \text {for}\: d \neq 0 \\x \left (A + B \tan {\left (c \right )}\right ) \left (a + b \tan {\left (c \right )}\right ) \cot {\left (c \right )} & \text {otherwise} \end {cases} \]

[In]

integrate(cot(d*x+c)*(a+b*tan(d*x+c))*(A+B*tan(d*x+c)),x)

[Out]

Piecewise((-A*a*log(tan(c + d*x)**2 + 1)/(2*d) + A*a*log(tan(c + d*x))/d + A*b*x + B*a*x + B*b*log(tan(c + d*x
)**2 + 1)/(2*d), Ne(d, 0)), (x*(A + B*tan(c))*(a + b*tan(c))*cot(c), True))

Maxima [A] (verification not implemented)

none

Time = 0.40 (sec) , antiderivative size = 52, normalized size of antiderivative = 1.41 \[ \int \cot (c+d x) (a+b \tan (c+d x)) (A+B \tan (c+d x)) \, dx=\frac {2 \, A a \log \left (\tan \left (d x + c\right )\right ) + 2 \, {\left (B a + A b\right )} {\left (d x + c\right )} - {\left (A a - B b\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{2 \, d} \]

[In]

integrate(cot(d*x+c)*(a+b*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="maxima")

[Out]

1/2*(2*A*a*log(tan(d*x + c)) + 2*(B*a + A*b)*(d*x + c) - (A*a - B*b)*log(tan(d*x + c)^2 + 1))/d

Giac [A] (verification not implemented)

none

Time = 0.42 (sec) , antiderivative size = 53, normalized size of antiderivative = 1.43 \[ \int \cot (c+d x) (a+b \tan (c+d x)) (A+B \tan (c+d x)) \, dx=\frac {2 \, A a \log \left ({\left | \tan \left (d x + c\right ) \right |}\right ) + 2 \, {\left (B a + A b\right )} {\left (d x + c\right )} - {\left (A a - B b\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{2 \, d} \]

[In]

integrate(cot(d*x+c)*(a+b*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="giac")

[Out]

1/2*(2*A*a*log(abs(tan(d*x + c))) + 2*(B*a + A*b)*(d*x + c) - (A*a - B*b)*log(tan(d*x + c)^2 + 1))/d

Mupad [B] (verification not implemented)

Time = 7.38 (sec) , antiderivative size = 69, normalized size of antiderivative = 1.86 \[ \int \cot (c+d x) (a+b \tan (c+d x)) (A+B \tan (c+d x)) \, dx=\frac {A\,a\,\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )}{d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (A+B\,1{}\mathrm {i}\right )\,\left (a+b\,1{}\mathrm {i}\right )}{2\,d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (A-B\,1{}\mathrm {i}\right )\,\left (b+a\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{2\,d} \]

[In]

int(cot(c + d*x)*(A + B*tan(c + d*x))*(a + b*tan(c + d*x)),x)

[Out]

(log(tan(c + d*x) + 1i)*(A - B*1i)*(a*1i + b)*1i)/(2*d) - (log(tan(c + d*x) - 1i)*(A + B*1i)*(a + b*1i))/(2*d)
 + (A*a*log(tan(c + d*x)))/d